package sample.chapter7.generic;

import java.util.ArrayList;
import java.util.List;

public class TestBadLegacy
{
	public static void main(String[] args)
	{
		List<Integer> intList = new ArrayList<Integer>();
		intList.add(4);
		intList.add(6);
		List legacyList = new ArrayList();
		List strList = new ArrayList<String>();
		
		Inserter in= new Inserter();
		in.insert(intList);
		
		for(Object i:intList)
			System.out.println(i.getClass().getName()+": "+i);
		
	}
}

class Inserter
{
	void insert(List list)
	{
		list.add(41);
		list.add(new String("42"));
		
		//just to show a cast is required
		int x = (Integer)list.get(0);
	}
}